home *** CD-ROM | disk | FTP | other *** search
- global oIndexScroller, gGlobalStepCount, gLocalStepCount, gInputField, gModeState, gAlphaState, gCurrEntryAttrib, gNewSetIsHereF, gchunksize, gFirstHotWord, gEpisFTchunksizeK, oIndexMediator, gTheFTword, gFTsearchscope, gModeNameLU, gNumofHits, gStatusField, gStardateLU, gStardLUlistSize, gFTstartSND, gESstartSND, gIndexSND, oTextScroller, gIndxScrollFldK, gTheMseWord, gStashedHitsList, gActiveResTopWin, gNopeSND, gholdTheFTword, gBeginCurlyQ, gEndCurlyQ, gComputerTypeK, gdescfield, gAposCurlyQ
-
- on hFindThisEntry
- hilite char 999 of field gInputField
- hReportStatus("Entry search commencing")
- hearit(gESstartSND)
- mSetDontResetLine(oIndexScroller, 0)
- set Lkall to field gInputField
- put " for [" & Lkall & "]" after field gStatusField
- set Lkall to hSwapIfSpecial(Lkall)
- hDetectMode(Lkall)
- hUserSelectEntry()
- if not (gModeState = #CHRO) then
- set lk to char 1 of Lkall
- set Lknum to charToNum(lk)
- if (Lknum >= 48) and (Lknum <= 122) then
- hSetIndex(lk, Lkall)
- hProcess(Lkall)
- else
- if (Lknum >= 48) and (Lknum <= 57) then
- hProcess(Lkall)
- else
- if hIsaQuote(lk) then
- set lk to char 2 of Lkall
- hSetIndex(lk, Lkall)
- hProcess(Lkall)
- else
- hReportStatus("Search unable to resolve...")
- end if
- end if
- end if
- else
- set lk to char 1 to 2 of Lkall
- hSetIndex(lk, Lkall)
- hProcess(Lkall)
- end if
- end
-
- on hMatchEntryToIndexLine pN
- put line pN of field gIndxScrollFldK into field gInputField
- hilite char 999 of field gInputField
- set Lkall to field gInputField
- hSetIndex(hFilterSearchChars(Lkall), Lkall, 1)
- hProcess(field gInputField)
- end
-
- on hTopicFind pNameToFind
- put pNameToFind into field gInputField
- hilite char 999 of field gInputField
- hCloseTopWin()
- forget(window gActiveResTopWin)
- hSetMode(#ENCY)
- hMiniFind()
- end
-
- on hMiniFind pUpdateF
- set Lkall to field gInputField
- hSetIndex(hFilterSearchChars(Lkall), Lkall, pUpdateF)
- hProcess(Lkall)
- end
-
- on hSetIndex pLetter, pEntry, pUpdateF
- hearit(gIndexSND)
- if gModeState = #EPISSUB then
- set pLetter to gAlphaState
- mSetDontResetLine(oIndexScroller, 1)
- end if
- if (pLetter = gAlphaState) or (gModeState = #FoundSet) then
- if pEntry = " " then
- hearit(gNopeSND)
- abort()
- end if
- set Lthelocalitemnum to hMatchToAttrib(pLetter, pEntry)
- if not pUpdateF then
- mShiftWindowToEntry(oIndexScroller, Lthelocalitemnum, 0)
- end if
- return
- else
- hGetNewAttrList(pLetter, 0)
- set Lthelocalitemnum to hMatchToAttrib(pLetter, pEntry)
- if voidp(Lthelocalitemnum) then
- return
- else
- if not pUpdateF then
- mShiftWindowToEntry(oIndexScroller, Lthelocalitemnum, 0)
- else
- mMatchScrollBar(oIndexScroller)
- end if
- end if
- end if
- end
-
- on hMatchToAttrib pLetter, pEntry
- global gHyperExceptions
- if gModeState = #FoundSet then
- set LthisMode to hGetMode(pEntry)
- set pLetter to hCapitalize(pLetter)
- set LthisItem to hConvertAlphaToItem(pLetter)
- set LmyAttrGroup to mGetModesAttribGroup(oIndexMediator, LthisMode, LthisItem)
- set gCurrEntryAttrib to getaProp(LmyAttrGroup, pEntry)
- if mWhatFSlistType(oIndexScroller) = 1 then
- set Lentrynm to mGetCurrLUShort(oSLlookup, pEntry)
- else
- set Lentrynm to pEntry
- end if
- set LthisFoundList to mGetModesAttribGroup(oIndexMediator, #FoundSet, 1)
- set Lnum to findPos(LthisFoundList, Lentrynm)
- hSetGlobalCounter(Lnum)
- hSetLocalCounter(Lnum)
- if voidp(gCurrEntryAttrib) then
- end if
- return Lnum
- end if
- hUpdateCurrItem(pLetter)
- set LmyAttrList to mGrabCurrAttrList(oIndexMediator, gModeState)
- hSetLocalCounter(findPos(LmyAttrList, pEntry))
- set vHoldAttrList to LmyAttrList
- set vHoldpletter to pLetter
- if gModeState = #ENCY then
- if voidp(gLocalStepCount) then
- hputmsg(">***hMatchToAttrib: Is this >" & pEntry & "<an exception?")
- set vHoldEntry to pEntry
- set pEntry to getaProp(gHyperExceptions, pEntry)
- if not voidp(pEntry) then
- set pLetter to char 1 of pEntry
- hUpdateCurrItem(pLetter)
- set LmyAttrList to mGrabCurrAttrList(oIndexMediator, gModeState)
- hSetLocalCounter(findPos(LmyAttrList, pEntry))
- if gLocalStepCount then
- end if
- else
- set gLocalStepCount to pEntry
- end if
- if voidp(gLocalStepCount) then
- set pEntry to vHoldEntry
- set pEntry to hTryCap(pEntry)
- hSetLocalCounter(findPos(LmyAttrList, pEntry))
- if gLocalStepCount then
- hReportStatus("Entry Found:" && pEntry)
- end if
- if voidp(gLocalStepCount) then
- set pEntry to vHoldEntry
- set vHoldEntry to pEntry
- set pEntry to hLastNameFirst(pEntry)
- set pLetter to char 1 of pEntry
- hUpdateCurrItem(pLetter)
- set LmyAttrList to mGrabCurrAttrList(oIndexMediator, gModeState)
- hSetLocalCounter(findPos(LmyAttrList, pEntry))
- if gLocalStepCount then
- hReportStatus("Entry Found:" && pEntry)
- end if
- if voidp(gLocalStepCount) then
- set pEntry to vHoldEntry
- set vHoldEntry to pEntry
- set pEntry to hIsADoctor(pEntry)
- hSetLocalCounter(findPos(LmyAttrList, pEntry))
- if gLocalStepCount then
- hReportStatus("Entry Found:" && pEntry)
- end if
- if voidp(gLocalStepCount) then
- set pEntry to vHoldEntry
- set vHoldEntry to pEntry
- set pEntry to hTryHarder(pEntry)
- set LmyAttrList to vHoldAttrList
- set pLetter to vHoldpletter
- hUpdateCurrItem(pLetter)
- hSetLocalCounter(findPos(LmyAttrList, pEntry))
- if gLocalStepCount then
- hReportStatus("Entry Found:" && pEntry)
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- if voidp(gLocalStepCount) then
- if (gModeState = #EPIS) and (pEntry contains "Star Trek") then
- set pEntry to " " & pEntry
- end if
- if gModeState <> #CHRO then
- hReportStatus("Still looking for a match...")
- sort(LmyAttrList)
- hSetLocalCounter(findPosNear(LmyAttrList, pEntry))
- else
- hearit(gNopeSND)
- hReportStatus("No exact match for that year in the Chronology.")
- abort()
- end if
- end if
- if gLocalStepCount > count(LmyAttrList) then
- hReportStatus("Entry" && pEntry & " not found even after trying alternative methods.")
- hearit(gNopeSND)
- abort()
- end if
- if gModeState <> #EPISSUB then
- mUpdateGlobalFromLocal(oIndexMediator)
- else
- hSetGlobalCounter(gLocalStepCount)
- end if
- set gCurrEntryAttrib to getAt(LmyAttrList, gLocalStepCount)
- return gLocalStepCount
- end
-
- on hGetNewAttrList pLetter, pSortFlag
- set pLetter to hCapitalize(pLetter)
- if not (gModeState = #EPISSUB) and not (gModeState = #FoundSet) then
- mSetCurrAttrList(oIndexMediator, "ATTRIB_" & pLetter & "_" & gModeState, gModeState)
- if the result = 0 then
- abort()
- end if
- hSetAlphaState(hCapitalize(pLetter))
- if gModeState = #CHRO then
- else
- if pSortFlag then
- hReportStatus("Sorting...")
- set Ls to the ticks
- sort(mGrabCurrAttrList(oIndexMediator, gModeState))
- set Ls to the ticks - Ls
- hReportStatus("Sorting complete.")
- else
- end if
- end if
- return 1
- else
- end if
- end
-
- on hFindThisWord
- hearit(gFTstartSND)
- set Lwordtofind to field gInputField
- hReportStatus("Fulltext search commencing for •" & Lwordtofind & "•")
- if gModeState = #TOPICS then
- set gFTsearchscope to #ALL
- end if
- set LFTlist to [:]
- if gFTsearchscope = #ALL then
- put " across all modes." after field gStatusField
- set Lhitlist to hLoadThreeFTs(Lwordtofind)
- if not objectp(Lhitlist) then
- hReportStatus("All-mode full text list containing >" & Lwordtofind & "< not retreivable.")
- return 0
- end if
- else
- put " in " & getaProp(gModeNameLU, gFTsearchscope) & " mode." after field gStatusField
- set LFTlist to hLoadFTindex(Lwordtofind, gFTsearchscope)
- if not objectp(LFTlist) then
- hReportStatus("Full text list containing >" & Lwordtofind & "< not retreivable.")
- hearit(gNopeSND)
- return 0
- end if
- set Lwordtofind to hInitCap(Lwordtofind)
- set Lhitlist to getaProp(LFTlist, Lwordtofind)
- end if
- if voidp(Lhitlist) then
- set Lhitlist to hTryFTPlurals(LFTlist, Lwordtofind)
- end if
- if voidp(Lhitlist) then
- set Lhitlist to hIsFTCurly(LFTlist, Lwordtofind)
- end if
- if not voidp(Lhitlist) then
- set gTheFTword to Lwordtofind
- set gNumofHits to count(Lhitlist)
- hUserSelectWord()
- hSetMode(#FoundSet)
- set gStashedHitsList to Lhitlist
- mSetupHitsList(oIndexScroller)
- set gNewSetIsHereF to 0
- put mSetOneFTfromLU(oSLlookup, gGlobalStepCount) into field gInputField
- hilite char 999 of field gInputField
- hMiniFind()
- mReDefineSlider(oIndexSlider, 1, mGetModesMaxEntryNum(oIndexMediator) - 6, 0)
- else
- hReportStatus("That word not found in the full text database.")
- hAnnounce("Selected Not Found...Search")
- end if
- end
-
- on hFillInputField pWithMe
- put hcleanup(pWithMe) into field gInputField
- hilite char 999 of field gInputField
- end
-
- on hGrabStringNsearch pthefield
- global gEditKeys
- set Lwhichword to gTheMseWord
- if Lwhichword > the number of words in field pthefield then
- abort()
- end if
- if gFirstHotWord then
- set x to word gFirstHotWord to gFirstHotWord + gchunksize - 1 of field pthefield
- set Lthisstring to hIsaSeeListItem(word Lwhichword of field pthefield, x)
- if not voidp(Lthisstring) then
- set x to Lthisstring
- end if
- hFillInputField(x)
- if gEditKeys then
- if the controlDown and the commandDown then
- hStoretheLink(x)
- end if
- end if
- hFindThisEntry()
- else
- if Lwhichword > 0 then
- if word Lwhichword of field pthefield = "SEE:" then
- hCompileSEEtoFound(Lwhichword, pthefield)
- abort()
- end if
- set lx to hcleanup(word Lwhichword of field pthefield)
- hSwitchFTsearchscope(gModeState)
- put lx into field gInputField
- hilite char 999 of field gInputField
- hFindThisWord()
- hUserGrabWord()
- end if
- end if
- end
-
- on hTryFTPlurals pList, pWord
- set Lnum to the number of chars in pWord
- if char Lnum of pWord = "s" then
- hReportStatus("Translating possible plural word form.")
- if char Lnum - 1 of pWord = "e" then
- if char Lnum - 2 of pWord = "i" then
- set pWord to hZapLastChar(pWord)
- set pWord to hZapLastChar(pWord)
- put "y" into char the number of chars in pWord of pWord
- else
- set pWord to hZapLastChar(pWord)
- set pWord to hZapLastChar(pWord)
- end if
- else
- set pWord to hZapLastChar(pWord)
- if char Lnum - 1 of pWord = gAposCurlyQ then
- set pWord to hZapLastChar(pWord)
- end if
- end if
- return getaProp(pList, pWord)
- end if
- end
-
- on hIsFTCurly pList, pWord
- if pWord contains "'" then
- put gAposCurlyQ into char offset("'", pWord) of pWord
- return getaProp(pList, pWord)
- end if
- end
-
- on hZapLastChar pWord
- delete char the number of chars in pWord of pWord
- return pWord
- end
-
- on hPrepHyperExceptions
- global gHyperExceptions
- set gHyperExceptions to [:]
- set gHyperExceptions to value(field "Hyperlink Exceptions")
- if not objectp(gHyperExceptions) then
- exit
- end if
- sort(gHyperExceptions)
- hPrepLinkTrapper()
- end
-
- on hSwapIfSpecial pEntry
- global gHyperExceptions
- set vHoldEntry to pEntry
- set pEntry to getaProp(gHyperExceptions, pEntry)
- if not voidp(pEntry) then
- return pEntry
- else
- return vHoldEntry
- end if
- end
-